terminals = ['+', '*', '(', ')', 'i', '$']
non_terminals = ['E', 'E\'', 'T', 'T\'', 'F','V']

# 构建预测分析表
parsing_table = {
    ('E', '('): [ 'T', 'E\''],
    ('E','i'):['T','E\''],
    ('E\'', '+'): ['+', 'T', 'E\''],
    ('E\'', '-'): ['-', 'T', 'E\''],
    ('E\'', ')'): [],
    ('E\'', '$'): [],
    ('T', '('): ['F', 'T\''],
    ('T', 'i'): ['F', 'T\''],
    ('T\'', '+'): [],
    ('T\'', '-'): [],
    ('T\'', '*'): ['*', 'F', 'T\''],
    ('T\'', '/'): ['/', 'F', 'T\''],
    ('T\'', ')'): [],
    ('T\'', '$'): [],
    ('F', '('): ['(', 'E', ')'],
    ('F', 'i'): ['V'],
    ('V','i'):['i','V'],
    ('V','*'):[],
    ('V','/'):[],
    ('V','-'):[],
    ('V','('):[],
    ('V','+'):[],
    ('V',')'):[],
    ('V','$'):[]
}

# LL(1)语法分析器
def ll1_parser(expression):
    stack = ['$']  # 分析栈
    symbol = expression[0]  # 输入符号
    top = 'E'  # 栈顶符号
    stack.append(top)
    while top != '$':
        if symbol.isalnum():symbol = 'i'
        if top in non_terminals and (top, symbol) in parsing_table:      
            production = parsing_table[(top, symbol)]
            stack.pop()  # 弹出栈顶符号
            stack.extend(reversed(production))  # 将产生式的右部推入栈中
        elif top == symbol:
            stack.pop()  # 弹出栈顶符号
            expression = expression[1:]  # 移除已经匹配的符号
            symbol = expression[0]  # 更新输入符号
        else:
            print('False',end='')
            return
        
        top = stack[-1]  # 更新栈顶符号
    
    if top == '$' and symbol == '$':
        print('True',end='')
    else:
        print('False',end='')


expression = input()
ll1_parser(expression + '$')